package types

import (
	"cuelang.org/go/cue/ast"
	"fmt"
	"strings"
)

type Ident struct {
	vv *ast.Ident
}

func (t *Ident) Value(ref bool) string {
	if strings.HasPrefix(t.vv.Name, "#") {
		format := "%s"
		if ref {
			format = "*%s"
		}
		return fmt.Sprintf(format, strings.TrimPrefix(t.vv.Name, "#"))
	}
	return t.vv.Name
}

func (t *Ident) Default() string {
	return ""
}
